You can attach behaviors to the entire document (that is, to the BODY
tag) or to links, images, form elements, or any of several other HTML elements. The browser determines which elements can accept behaviors. Internet Explorer 4.0, for example, has a much wider array of events for each element than Netscape Navigator 4.0 or any 3.0 browser.
You can specify more than one action for each event. Actions occur in the order in which they're listed in the Actions column of the Behavior inspector. For information on changing the order of actions, see Changing a behavior.
To attach a behavior:
1 | Select an object. |
To attach a behavior to the entire page, click the <body> tag in the tag selector at the bottom left of the Document window. |
|
2 | Choose Window > Behaviors to open the Behavior inspector, or click the Behaviors button on the Launcher. |
The HTML tag of the selected object appears in the title bar of the Behavior inspector. | |
3 | Click the plus (+) button and choose an action from the Actions pop-up menu. |
Actions that are dimmed in the menu can't be chosen, because they won't work in the current document. For example, the Play Timeline action is dimmed if the document has no timelines. If no events are available for the selected object, all actions are dimmed. | |
A dialog box appears, displaying parameters and instructions for the action. | |
4 | Enter parameters for the action, and click OK. |
All actions provided in Dreamweaver work in 4.0 and later browsers. Some actions do not work in older browsers. See Using the behavior actions that ship with Dreamweaver. | |
5 | The default event to trigger the action appears in the Events column. If this is not the trigger event you want, choose another event from the Events pop-up menu. |
Different events appear in the Events pop-up menu depending on the selected object and on the browsers specified in the Events For pop-up menu. Events may be dimmed if the relevant objects do not yet exist on the page or if the selected object cannot receive events. If the expected events don't appear, make sure the correct object is selected, or change the target browsers in the Events For pop-up menu. | |
If you're attaching a behavior to an image, some events (such as onMouseOver ) appear in parentheses. These events are available only for links. When you choose one of them, Dreamweaver wraps an A tag around the image to define a dummy link. The dummy link is represented by a number sign (#) in the Property inspector's Link box. You can change the link value if you want to turn it into a real link to another page, but if you delete the number sign without replacing it with another link, you will remove the behavior. |
|
![]() |